package com.song.seckill.service;

import com.google.common.util.concurrent.RateLimiter;
import org.springframework.stereotype.Component;

@Component
public class RateLimiterService {
    // 每秒允许1000个请求[5,12](@ref)
    private static final RateLimiter limiter = RateLimiter.create(1000);

    public boolean tryAcquire() {
        return limiter.tryAcquire();
    }


}
